#ifndef WORLD_H
#define WORLD_H

#include <GameGlobals.h>

#include <Physics.h>
#include <RenderManager.h>
#include <ObjectManager.h>
#include <PlayerInterface.h>
#include <HUDManager.h>

#include <MainMenu.h>
#include <Command.h>
#include <list>

class INIFile;
class Camera;

class World
{
	friend class Area;
	public:
		World(INIFile* configFile);
		~World();

		void Initialize();
		void SetLoading(truth isLoading);
		void SetMainMenu(truth inMainMenu);
		void UnloadCurrentArea();
		void SetArea(Area* area);
		Area* GetCurrentArea();
		void InitCurrentArea();
		void Input(const bool* keys, float fps);
		void Update(float fps);
		void ProcessCommands();
		void Draw();
		void AddCommand( Command* c );
		void AddObject( BaseObject* c );
		void RemoveObject( BaseObject* c );
		void Cleanup();

		Camera* GetCamera() const { return currentCam; }

		INIFile* config;

	private:

		void DrawWorldCenteredDebugCross();
		void DrawLoadingScreen();
		
		std::list<Command*> commands;
		Area* currentArea;
		PhysicsManager physics;
		RenderManager renderer;
		ObjectManager gameObjects;

		unsigned loadingCounter;
		unsigned loadingDirection;
		vec2 loadingPoint;
		truth loading;
		float gamefps;
		Camera* currentCam;
		PlayerInterface player;
		HUDManager hudDisplay;

		MainMenu mainmenu;
		truth inmenu;
};


#endif